<?php

namespace Common\Helper\MessageBroker;

interface MessageBrokerInterface
{

    /*
     * config could be used to set username/ip, etc...
     */
    public function setConfig(array $config);
    public function getConfig();

    /*
     * Connect to message broker service
     */
    public function connect();
    public function isConnected();

    /*
     * Disconnect from the message broker service
     */
    public function disconnect();

    /*
     * Declare a queue
     */
    public function declare_queue($queue_name);

    /*
     * Get random queue generated by the message broker
     */
    public function get_random_queue();

    /*
     * Declare a exchange
     */
    public function declare_exchange($exchange_name, $exchange_type, array $arguments);

    /*
     * Bind a queue to an exchange with the specified routing key
     */
    public function bind_queue($queue_name, $exhange_name, $routing_key);

    /*
     * Bind random queue (no defined queue needed) to an exchange with the specified routing key
     */
    public function bind_random_queue($exhange_name, $routing_key);

    /*
     * Pulish a data to the exchange
     */
    public function publish($data, $exchange_name, $routing_key, $delivery_mode, array $headers);

    /*
     * Consume a data from the defined queue
     */
    public function consume($queue_name, $callback);
    public function acknowledge($tag);

    /*
     * Cancel the consume
     */
    public function cancel_consume($consumer_tag);
    /*
     * to give it a pause
     */
    public function wait();

    /*
     * To return if the message broker is busy
     */
    public function isBusy();
    public function setTimeout($timeout);
}
